document.addEventListener("keydown", function(event) {
    if (event.keyCode == '32') {
        console.log('space >> fire backbutton');
        var event = new CustomEvent("backbutton", { "detail": "Symulacja eventu z phonegap.js" });
        document.dispatchEvent(event);
    }
}, false);
console.log('phonegap simulate back button event');

setTimeout(function () {
    
    // Create the event
    var event = new CustomEvent("deviceready", { "detail": "Symulacja eventu z phonegap.js" });

    // Dispatch/Trigger/Fire the event
    document.dispatchEvent(event);
    
    console.log('phonegap dispatched deviceready event');
}, 2000);
